/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pong;

import java.awt.Point;
import java.awt.Rectangle;

/**
 *
 * @author Administrator
 */
public class Paddle extends Rectangle
{
    public static final int DEFAULT_HEIGHT = 25;
    public static final int DEFAULT_WIDTH = 25;
     
    /**
     * Constructs a new Rectangle whose upper-left corner is specified as the
     * startingLocation Point and whose width and height are specified by the 
     * arguments of the same name.
     * @param startingLocation the specified Point for the top left coordinate of the Paddle
     * @param width the width of the Paddle
     * @param height the height of the Paddle
     */
    public Paddle(Point startingLocation,int width, int height) 
    {
        super(startingLocation.x, startingLocation.y, width, height);
    }
    
    /**
     * Constructs a Paddle whose upper-left corner is specified as the startingLocation 
     * Point whose width and height are the Paddle's class' default width and default
     * height
     * @param startingLocation the specified Point for the top left coordinate of the Paddle
     */
    public Paddle(Point startingLocation) 
    {
        this(startingLocation, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    }

    /**
     * Moves the Paddle up or down depending on the specified VerticalDirection
     * @param dir the VerticalDirection to move the Paddle
     */
    public void move(VerticalDirection dir)
    {
        Point location = this.getLocation();
        if(dir == VerticalDirection.DOWN)
        {
            this.setLocation(location.x,location.y + 1);
        }
        else
        {
            this.setLocation(location.x,location.y - 1);
        }
    }
}
